package gxb.test12;

interface Shape {
    double area();
}
class Triangle implements Shape{
    private int width=50;
    private int height=20;
    @Override
    public double area() {
        return width*height/2;
    }
}
class Rectangle implements Shape{
    private int width=50;
    private int height=20;
    @Override
    public double area() {
        return width*height;
    }
}
public class ShapeTest{
    public static void main(String[] args) {
        Triangle triangle = new Triangle();
        Rectangle rectangle = new Rectangle();
        showArea(triangle);
        showArea(rectangle);
    }
    public static void showArea(Shape s){
        System.out.println("area="+s.area());
    }
}
